<template>
  <div>
    <div>
      <input v-model="username" type="text">
    </div>
    <div>
      <input v-model="password" type="text">
    </div>
    <div>
      <button @click="login">登录</button>
    </div>
    <div>
      <button @click="getMenus">获取当前登录用户菜单</button>
    </div>
  </div>
</template>

<script lang='ts' setup>
import {loginApi,getMenusApi} from "@/apis/userApi"
import {IUser} from "@/inerfaces/userInterfaces"
const username = ref("")
const password = ref("")

const login =async ()=>{
  console.log(username.value);
  console.log(password.value);
  const obj:IUser = {
    username:username.value,
    password:password.value
  }
  const res = await loginApi(obj)
  console.log(res);
  const token = res.data.data.token
  localStorage.setItem("token",token)

  
}

const getMenus =async ()=>{
  const res = await getMenusApi("bobo")
  console.log(res);
  
}
</script>

<style lang='scss' scoped>
</style>